package com.kangye.game.controller;

import com.alibaba.fastjson.JSON;
import com.kangye.game.pojo.Gameclass;
import com.kangye.game.service.GameClassService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: game_orders
 * @description:
 * @author: lgk
 * @create: 2021-09-01 11:14
 **/
@RestController
@CrossOrigin
public class InitController {
    @Resource(name = "gameclass")
    private GameClassService gameClassService;

    @RequestMapping("zong.action")
    public Map<String,String> ad(){
        List<Gameclass>gameclasses=gameClassService.findGameClass();
        String json1= JSON.toJSONString(gameclasses);
     Map<String,String> a=new HashMap<>();
     a.put("a",json1);
   /*     List<Gameclass> sa= gameClassService.findGameClass();//也可以这种传参
        List<String> srt=new ArrayList<>();
        for (Gameclass g : sa){
            srt.add(JSON.toJSONString(g));
        }*/

      return a;
    }

}
